import axios, {ResDataType} from "./ajax";

// 获取用户信息
export async function getUserInfoService(): Promise<ResDataType> {
    return await axios.get('/api/user/info')
}

// 注册用户
export async function registerService(username: string, password: string, nickname?: string): Promise<ResDataType> {
    return await axios.post('/api/user/register', {username, password, nickname: nickname || username})
}

// 登录
export async function loginService(username: string, password: string): Promise<ResDataType> {
    return await axios.post('/api/user/login', {username, password})
}